package com.company.ems.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseUtil {
    //本地连接
//    private static final String URL = "jdbc:mysql://localhost:3306/gq_webapp4?useSSL=false&serverTimezone=UTC";
    //云服务器
    private static final String URL = "jdbc:mysql://159.75.137.11:3306/ems?useSSL=false&serverTimezone=UTC";
    private static final String USERNAME = "admin";
    private static final String PASSWORD = "soft2025"; //

    static {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            throw new ExceptionInInitializerError(e);
        }
    }

    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(URL, USERNAME, PASSWORD);
    }
}